package com.manager.user.module.entity.view;

import com.manager.commons.utils.Base64Utils;
import com.manager.commons.utils.StringUtil;

import java.io.Serializable;

/**IntelliJ IDEA
 * GenFiles
 * 文件管理
 *
 * @author manager
 * @version 1.0
 */
public class FileInfoView implements Serializable {

    private String id;
    private String name;//文件名称
    private String thumb;//文件地址用于显示 缩率图显示
    private String type;//文件类型  directory文件夹,png|gif|png|image图片,其它任意
    private long fileSize;//文件大小，单位KB
    private String pid;//父级权限id
    private String fileExt;
    private String fileSizeName;
    private String createTime;
    private String modifyTime;
    private String resolutionTitle;//分辨率
    private String resolution;//分辨率
    private String duration;//时长
    private String goId;
    private String ypath;

    public String getModifyTime() {
        if (StringUtil.isNotEmpty(modifyTime)) {
            return modifyTime;
        }
        return createTime;
    }

    public void setModifyTime(String modifyTime) {
        this.modifyTime = modifyTime;
    }

    public String getGoId() {
        if (StringUtil.isNotEmpty(goId)) {
            return "1";
        }
        return goId;
    }

    public void setGoId(String goId) {
        this.goId = goId;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public long getFileSize() {
        return fileSize;
    }

    public void setFileSize(long fileSize) {
        this.fileSize = fileSize;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getFileExt() {
        return fileExt;
    }

    public void setFileExt(String fileExt) {
        this.fileExt = fileExt;
    }

    public String getFileSizeName() {
        return fileSizeName;
    }

    public void setFileSizeName(String fileSizeName) {
        this.fileSizeName = fileSizeName;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getThumb() {
        return thumb;
    }

    public void setThumb(String thumb) {
        this.thumb = thumb;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getResolutionTitle() {
        return resolutionTitle;
    }

    public void setResolutionTitle(String resolutionTitle) {
        this.resolutionTitle = resolutionTitle;
    }

    public String getDuration() {
        return duration;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public String getResolution() {
        return resolution;
    }

    public void setResolution(String resolution) {
        this.resolution = resolution;
    }


    public String getYpath() {
        if (StringUtil.isNotEmpty(ypath)) {
            String ecode = Base64Utils.encode("http://rml.yuejia100.net/res/user/files" + ypath + "/" + name);
            // + "&watermarkTxt=" + "动态水印动态水印动态水印动态水印"
            return "http://preview.yuejia100.net/onlinePreview?url=" + ecode;
        }
//        if (StringUtil.isNotEmpty(ypath)) {
//            String ecode = Base64Utils.encode("http://127.0.0.1:8080/manager-res/user/files" + ypath + "/" + name);
//            // + "&watermarkTxt=" + "动态水印动态水印动态水印动态水印"
//            return "http://127.0.0.1:8019/onlinePreview?url=" + ecode;
//        }
        return ypath;
    }

    public void setYpath(String ypath) {
        this.ypath = ypath;
    }
}
